///////////////////////////////////////////////////////////////
// File: "CCodeProfiler.h"
// Author: James Gonzalez (JG)
// Purpose: Creates timers to check performance of functions
///////////////////////////////////////////////////////////////

#pragma once
#include <Windows.h>
#include <string>

class CCodeProfiler
{

private:
	LARGE_INTEGER m_liStart;
	LARGE_INTEGER m_liEnd;
	LARGE_INTEGER m_liFrequency;
	double m_dAverage;
	double m_dTimeBetween;
	double m_dSum;
	double m_dTotalHits;
	bool m_bPrintNameOnce;
	bool m_bIsActive;
	std::string m_szFolder;
	std::string m_szFunctionName;
	
public:
	///////////////////////////////////////////////////////////////
	// File: "Accessors.h"
	// Date: September 16, 2008
	// Purpose: Gets Data
	///////////////////////////////////////////////////////////////
	LARGE_INTEGER GetStart() const { return m_liStart; }
	LARGE_INTEGER GetEnd() const { return m_liEnd; }
	LARGE_INTEGER GetFrequency() const { return m_liFrequency; }
	double GetAverage() const { return m_dAverage; }
	double GetTimeBetween() const { return m_dTimeBetween; }
	bool GetIsActive() const { return m_bIsActive; }
	std::string GetFolder() const { return m_szFolder; }

	///////////////////////////////////////////////////////////////
	// File: "Mutators.h"
	// Date: September 16, 2008
	// Purpose: Sets Data
	///////////////////////////////////////////////////////////////
	void SetStart(LARGE_INTEGER val) { m_liStart = val; }
	void SetEnd(LARGE_INTEGER val) { m_liEnd = val; }
	void SetFrequency(LARGE_INTEGER val) { m_liFrequency = val; }
	void SetAverage(double val) { m_dAverage = val; }
	void SetTimeBetween(double val) { m_dTimeBetween = val; }
	void SetIsActive(bool val) { m_bIsActive = val; }
	void SetFolder(std::string val) { m_szFolder = val; }

	///////////////////////////////////////////////////////////////
	// File: "CCodeProfiler.h"
	// Date: September 16, 2008
	// Purpose: Constructor
	///////////////////////////////////////////////////////////////
	CCodeProfiler();
	
	///////////////////////////////////////////////////////////////
	// File: "~CCodeProfiler.h"
	// Date: September 16, 2008
	// Purpose: Destructor
	///////////////////////////////////////////////////////////////
	~CCodeProfiler(){}

	///////////////////////////////////////////////////////////////
	// File: "StartTimer"
	// Date: September 16, 2008
	// Purpose: Starts the timer
	///////////////////////////////////////////////////////////////
	void StartTimer(std::string szFunctionName);

	///////////////////////////////////////////////////////////////
	// File: "EndTimer"
	// Date: September 16, 2008
	// Purpose: End the timer
	///////////////////////////////////////////////////////////////
	void EndTimer();

	///////////////////////////////////////////////////////////////
	// File: "OutToFile_AVG"
	// Date: September 16, 2008 
	// Purpose: out average times to a file
	///////////////////////////////////////////////////////////////
	void OutToFile_AVG();

	///////////////////////////////////////////////////////////////
	// File: "CalcAverage"
	// Date: September 16, 2008 
	// Purpose: Calculates the average
	///////////////////////////////////////////////////////////////
	double CalcAverage();

	///////////////////////////////////////////////////////////////
	// File: "CalcTimeBetween"
	// Date: September 16, 2008 
	// Purpose: Calculates the time between start and end
	///////////////////////////////////////////////////////////////
	double CalcTimeBetween();


	///////////////////////////////////////////////////////////////
	// File: "SetFunctionName"
	// Date: September 16, 2008 
	// Purpose: out each time to a file
	///////////////////////////////////////////////////////////////
	void SetFunctionName(char * szFunctionName);



};